<!--
 * @Author: luoqi
 * @Date: 2022-04-17 20:41:54
 * @LastEditors: luoqi
 * @LastEditTime: 2022-05-03 18:07:09
 * @Description: 
-->
<template>
  <!-- 收藏疾病列表 -->
  <el-row class="Ctogether">
    <el-col :span="24">
      <p>收藏疾病列表</p>
      <div class="shoucangjibingliebiao">
        <router-link
          :to="{ name: 'DiseaseDetails', params: { id: item.targetId } }"
          v-for="(item, index) in illnessList"
          :key="index"
        >
          <div class="illnessList">
            <div>{{ item.title }}</div>
            <div>
              <el-tag
                type="success"
                class="lable_s"
                v-for="(el, index) in item.tag.split(',')"
                :key="index"
                >{{ el }}</el-tag
              >
            </div>
          </div>
        </router-link>
      </div>
    </el-col>
  </el-row>
</template>

<script>
export default {
  props: ["collection"],
  data() {
    return {
      illnessList: [
        {
          name: "偏头痛",
          labelList: ["标签一", "标签二", "标签三"],
        },
      ],
    };
  },
  watch: {
    collection(newData, old) {
      if (newData) {
        if (this.$route.path == "/main/MyHome/mydisease") {
          this.illnessList = this.$store.state.mySelect.sicknessList;
        } else {
          this.illnessList = this.$store.state.herData.sicknessList;
        }
      }
    },
  },
  created() {
    if (this.$route.path == "/main/MyHome/mydisease") {
      this.illnessList = this.$store.state.mySelect.sicknessList;
    } else {
      console.log(this.$store.state.herData)
      this.illnessList = this.$store.state.herData.collection.sicknessList;
    }
  },
};
</script>

<style lang="less" scoped>
@import url("../../less/myhome.less");
</style>